<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link href='http://fonts.googleapis.com/css?family=Arvo' rel='stylesheet' type='text/css'>
<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Feedback</title>
</head>
<body>
<div id="menu-wrapper">
	<div id="menu">
		<ul>
			<li class="current_page_item"><a href="Home.html">Homepage</a></li>
			<li><a href="Login.jsp">Login</a></li>
			<li><a href="Registrazione.jsp">Registrazione</a></li>
			<li><a href="RicercaNonReg.html">Ricerca</a></li>
		</ul>
	</div>
	<!-- end #menu -->
</div>
<div id="page">
		<div id="page-bgtop">
			<div id="page-bgbtm">
				<div id="content">
					<div class="post">
						<h2 class="title">Lista Feedback</h2>
						<div class="entry">  
							<%  int size = Integer.parseInt(request.getAttribute("size").toString());
							
							    if(size == 0) {
								  
								     out.println(request.getAttribute("err"));
								   
							      }
							   
							      else {
							    	  
							    	  out.println("<ol>"); 
							    	  
							    	  for(int i = 0; i < size; i++) {
							   		   
							   		     int giorno = Integer.parseInt(request.getAttribute("giorno" + i).toString());
							   		     int mese = Integer.parseInt(request.getAttribute("mese" + i).toString()) + 1;
							   		     int anno = Integer.parseInt(request.getAttribute("anno" + i).toString()) + 1900;
							   		     int ore = Integer.parseInt(request.getAttribute("ore" + i).toString());
							   		     int minuti = Integer.parseInt(request.getAttribute("minuti" + i).toString());
							   		     int secondi = Integer.parseInt(request.getAttribute("secondi" + i).toString());
							   		     String sec = new String();
							   		     if(secondi < 10) {
							   		    	 
							   		    	 sec = "0" + Integer.toString(secondi);
							   		    	 
							   		     }
							   		     else {
							   		    	 
							   		    	 sec = Integer.toString(secondi);
							   		    	 
							   		     }
							   		     String mittente = request.getAttribute("mittente" + i).toString();
							   		     float v = Float.parseFloat(request.getAttribute("voto" + i).toString());
							   		     int voto = (int)v;
							   		     String commento = request.getAttribute("commento" + i).toString();
							   		     
							   		     out.println("<li>Feedback rilasciato il: " + giorno + "-" + mese + "-" + anno + " ");
							   		     out.println("alle ore " + ore + ":" + minuti + ":" + sec + " ");
							   		     out.println("dall'utente "  + mittente + " ");
							   		     out.println("con voto: " + voto + " ");
							   		     out.println("<a href=\"DettFeedNonReg.jsp?dettaglio=" + commento + "&username=" + request.getAttribute("username") + "\">");
							   		     out.println("Dettaglio");
							   		     out.println("</a></li>");
							   		   
							   	      }
							    	  
							    	  out.println("</ol>");
							    	  
							      }
							%>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</body>
</html>